div.container
  h1 Settings
  h2 RGB Lights
  p Setup:&nbsp;
    a(href="http://ni-c.github.com/heimcontrol.js/plugins/rgblights.html") http://ni-c.github.com/heimcontrol.js/plugins/rgblights.html
  - if (typeof(success) !== 'undefined')
    div.alert.alert-success.fade.in
      button.close(type="button", data-dismiss="alert") ×
      =success
  div.row16
    form(action="/settings/rgblights", method="post")
      div#rgblights
        each item, i in items
          div.plugin-container.rgblights.settings(id="#{item._id}")
            button.btn.btn-danger.pull-right.delete(type="button",data-delete="#{item._id}")
              i.icon-trash.icon-large
              |  Delete
            label(for="description") Description (optional):
            input(type="text", name="data[#{i}][description]", value="#{item.description}")
            label(for="pin") Arduino PINs:
            input.rgb.uppercase(type="text", name="data[#{i}][pins][R]", placeholder="R", maxlength="2", required="1", value="#{item.pins.R}", pattern="^A[0-9]|[0-9]{1,2}$")
            input.rgb.uppercase(type="text", name="data[#{i}][pins][G]", placeholder="G", maxlength="2", required="1", value="#{item.pins.G}", pattern="^A[0-9]|[0-9]{1,2}$")
            input.rgb.uppercase(type="text", name="data[#{i}][pins][B]", placeholder="B", maxlength="2", required="1", value="#{item.pins.B}", pattern="^A[0-9]|[0-9]{1,2}$")
              
            input(type="hidden", name="data[#{i}][_id]", value="#{item._id}")
            input(type="hidden", name="data[#{i}][status]", value="#{item.status}")
          
      p.rgblights.buttons
        button.btn.btn-info.add(data-target="rgblights", type="button") 
          i.icon-plus.icon-large
          |  Add
      
        button.btn.btn-success.save(type="submit") 
          i.icon-save.icon-large
          |  Save
          
input(type="hidden", name="iterator", id="iterator", value=(items.length))

div.plugin-container.rgblights.settings#template(style="display: none;")
  button.btn.btn-danger.pull-right.delete(type="button")
    i.icon-trash.icon-large
    |  Delete
  label(for="description") Description (optional):
  input(type="text", name="data[%i%][description]", placeholder="Living room")
  label(for="pin") Arduino PIN:
  input.rgb.uppercase(type="text", name="data[%i%][pins][R]", placeholder="R", maxlength="2", required="1", pattern="^A[0-9]|[0-9]{1,2}$")
  input.rgb.uppercase(type="text", name="data[%i%][pins][G]", placeholder="G", maxlength="2", required="1", pattern="^A[0-9]|[0-9]{1,2}$")
  input.rgb.uppercase(type="text", name="data[%i%][pins][B]", placeholder="B", maxlength="2", required="1", pattern="^A[0-9]|[0-9]{1,2}$")

  input(type="hidden", name="data[%i%][status]", value="0")